<template>
    <view class="flex_wrap flex_column bigBox">
        <u-image
            :src="image"
            mode="aspectFill"
            height="1152rpx"
            width="690rpx"
            :customStyle="{
                borderRadius: '16rpx 16rpx 16rpx 16rpx',
                marginBottom: '30rpx',
            }"
        ></u-image>
        <text>-长按图片进行保存转发-</text>
        <u-gap height="60rpx" bgColor="#fff"></u-gap>
        <u-icon
            name="trash"
            color="#bbb"
            size="28"
            @click="delet"
            v-if="authority === 'salesman'"
        ></u-icon>
    </view>
</template>

<script>
import { objectFileUpdate } from "@/api/login.js";
export default {
    data() {
        return {
            image: "https://oneredhealth.oss-cn-hangzhou.aliyuncs.com/2023/10/18/ed826ff5be2f4a4e9933665403cc1aa0.png",
            fileId: "",
            customerId: "",
            authority: this.$store.getters?.authority ?? "customer",
        };
    },
    onLoad(o) {
        if (o && o.image) this.image = o.image;
        if (o && o.fileId) {
            this.fileId = o.fileId;
            this.customerId = o.customerId;
            uni.setNavigationBarTitle({
                title: "图片",
            });
        }
    },
    methods: {
        async delet() {
            const { data, code } = await objectFileUpdate({
                removeFileIds: [this.fileId],
                unionId: this.customerId,
                unionType: 0,
            });
            if (code === 200) {
                uni.$u.toast("删除成功");
                uni.$emit("currentTab", 3);
                uni.navigateBack({
                    delta: 1,
                });
            }
        },
    },
};
</script>

<style lang="scss" scoped>
.bigBox {
    width: 100%;
    height: 100vh;
    background-color: #fff;
    position: relative;
    align-items: center;
    padding-top: 40rpx;
    .box {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1;
    }
    .imageBox {
        width: 670rpx;
        height: 1180rpx;
        background: #f3ebe0;
        border-radius: 16rpx 16rpx 16rpx 16rpx;
        padding: 48rpx;
        box-sizing: border-box;
        position: absolute;
        z-index: 2;
        text {
            position: absolute;
            left: 29%;
            bottom: 16%;
        }
    }
}
</style>
